package util.content.fliter;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EngLineFliter {

	public String fliter(String engLineTxt) {
		ArrayList<String> txtList = new ArrayList<String>();
		Pattern p = Pattern.compile(".+");
		Matcher m = p.matcher(engLineTxt);
		String withoutTagString = "";
		while (m.find()) {

			txtList.add(m.group());
		}
		System.out.println(txtList.get(0));
		for (int i = 0; i < txtList.size(); i++) {
			Pattern engTagPattern = Pattern.compile("(.*)(,\\W*?[ezyoevwi])");
			Matcher engTagMatcher = engTagPattern.matcher(txtList.get(i));
			System.out.println(engTagMatcher.find());
			if (!engTagMatcher.find()) {
				continue;
			} else {
				String eacheLine = engTagMatcher.group(1);
				Pattern wordPattern = Pattern.compile("(<)([a-zA-Z]{2,100})(>)");
				Matcher wordMatcher = wordPattern.matcher(eacheLine);
				while (wordMatcher.find()) {
					eacheLine = eacheLine.replaceAll(wordMatcher.group(), wordMatcher.group(2));
				}
				txtList.set(i, eacheLine);
			}
			for (int j = 0; j < txtList.size(); j++) {
				withoutTagString = withoutTagString + txtList.get(j);
			}
		}
		return engLineTxt;
	}
}
